


"""name="0123456789"
print(name[0])
print(name[1])
print(name[2])
print(name[3])
print(name[::-1])"""
"""test="my name si ni die ni"
print(test.find("ni"))
print(test.rfind("ni"))
print(test.count("ni"))
print(test.index("ni",13,999))
print(test.rindex("ni",13,999))
print(test.replace("ni","123",2))"""


test="talking to the moon----trying to get to you---"
"""print(test.replace("ing",'',2))
print(test.split("to",9))
print(test.split("to",2))
print(test.split("to",1))"""
"""list1=["talking","to","the","moon"]
print(' '.join(list1))
"""
"""def findpython(list):
    a=list.findda("python")
    if(a==-1):
        print("no python")
    else:
        print(f"the location is{a}")
        print(list.replace("python","java",1))
list=input("plase input a string:")
findpython(list)"""

"""test="   family who knows   "
print(f"{test.lstrip()}")
print(f"{test.strip()}")
print(f"{test.rstrip()}")
print(f"{test.rjust(50,'.')}")
print(f"{test.center(50,'.')}")
print(test.find("who"))
print(test.startswith("who",10,60))
print(test.endswith("who",0,13))
print(test.isalpha())
print(test.isdigit())
print(test.isalnum())
print(test.isspace())"""

"""s1={1,2,3,4,56,20,20,99,'hjh'}
print(s1)
s2=set('adwadawdad')
print(s2)
s4=set('')
print(s4)
s5={''}
print(s5)
print(type(s4))
print(type(s5))
print(type(s2))
s1.remove(99)
s1.remove('hjh')
s1.add(10020)
s1.pop(10020)
print(s1)
"""

"""
tuple1=(1,2,3,4,5,6,7,8)
print(tuple1[1])
print(tuple1)
list=['heool',"wwdad",'tom']
if 'tom' in list:print('yes')
list.insert(1,'hjh')
print(list)
list.pop(1)
list1=[1,3,5,78,90,45]
list1.sort()
print(list1)
print(len(list1))"""
"""list2=[['tom'],'tom']
print(list2[0].index('tom'))"""


"""dict1={'name':'yc','age':20,'grade':'three'}
print(dict1['name'])
print(dict1.get('name'))
print(dict1.keys())
print(type(dict1.keys()))
print(dict1.values())

jihe1=set()
for i in range(0,10):
    if i%2==1:
        jihe1.add(i)
print(jihe1)"""
"""number1=(i for i in range(0,10) if i%2==1)
print(number1)"""

"""import random

print("开始游戏")"""

"""while True:
    comnumber = random.randint(0, 2)
    mynumber=int(input("请输入你的：(1剪刀2石头0布)"))
    if comnumber ==0:
        print("电脑是布")
        if mynumber==0:
            print("平局下一把")
            continue
        elif mynumber==1:
            print("你赢了")
            break
        else:
            print("你输了")
            break
    elif comnumber ==2:
        print("电脑是石头")
        if mynumber==2:
            print("平局下一把")
            continue
        elif mynumber==0:
            print("你赢了")
            break
        else:
            print("你输了")
            break
    else:
        print("电脑是剪刀")
        if mynumber==1:
            print("平局下一把")
            continue
        elif mynumber==2:
            print("你赢了")
            break
        else:
            print("你输了")
            break"""

"""i=0
result=1
while i<=100:
    result+=i
    i+=2
print(result)"""

"""mylist=input("请输入一个字符串")

list2=[]
a=len(mylist)
for i in range(a-1,-1,-1):
    list2.append(mylist[i])
print(''.join(list2))"""


"""myyuple=("yc","game","pp")
print(myyuple[0])
print(myyuple[1])
print(myyuple[2])"""

"""money=int(10000)
year=1
while (1):
    print(f"第{year}年，本金为{money}元")
    money+=money*0.0325
    print(f"一共{money}元")
    year+=1
    if money >= 20000:
        break"""

"""for i in range(1,30):
    for j in range(i,i+8):
        if(i*j==(i+j)*6 and i!=j):
            print(f"妹妹{i}岁，姐姐{j}岁")"""

"""for i in range(11,80):
    if(i**3>=1000 and i**3<10000):
        if(i**4>=100000 and i**4<1000000):
            a=str(i**3)
            b=str(i**4)
            list=[]
            list1=[int(char) for char in a]
            list2=[int(char) for char in b]
            list.extend(list1)
            list.extend(list2)
            for l in range(10):
                if l in list:
                    continue
                else:
                    break
            else:
                print(i)
"""

"""list=['a.py','b.jpg']
for i in list:
    if 'jpg' in i:
        print(i)"""




"""list1=['1','2']
for i, j in enumarate(list1):
    print(i,j)"""

"""a=[1,2,3,4,5,6,7,7]
b=tuple(a)
print(b)
c=list(b)
print(c)
d=set(c)
print(d)
"""
"""list1=[i for i in range(999)]
print(list1)"""
"""tuple1=(i for i in range(999))
print(tuple1)"""
"""list2=[i for i in range(999) if i%2==0]
print(list2)
list3=[(i,j) for i in range(99) for j in range(99)]
print(list3)"""


"""list1=['a','b','c']
list2=[1,2,3]
dict1={list1[i]:list2[i] for i in range(3)}
print(dict1)
print(dict1.items())
count1={key:value for key,value in dict1.items() if value==2}
print(count1)
print(type(count1))
count2={i for i in range(10) if i%2==0}
print(count2)
print(type(count2))"""


"""mydict={'a':1,'b':2}
a,b=mydict
print(a,b)
print(mydict[a])
print(mydict[b])"""
"""a=["hello",'world','yoyo',"congraduation"]
b=a[0]
for i in a:
    if len(i)>=len(b):
        b=i
print(b)"""
"""a=[1,-6,2,-5,9,4,20,-3]
for i in range(len(a)):
    for j in range(i+1,len(a)):
        if a[i]>a[j]:
            temp=a[i]
            a[i]=a[j]
            a[j]=temp

print(a)
def sorted(a):
    list1=[]
    for i in a:
        list1.append(abs(i))
    list1.sort()
    return list1
print(sorted(a))"""


def add_info():
    name=input("请输入姓名：")
    age=int(input("请输入年龄："))
    sex=input("请输入性别：")
    global info
    for i in info:
        if i['name']==name and i['age']==age and i['sex']==sex:
            print("该用户已存在")
            break

    dict1={}
    dict1['name']=name
    dict1['age']=age
    dict1['sex']=sex
    info.append(dict1)
    print(info)

def delete_info():
    while True:
        number=int(input("请输入要删除的序号："))
        global info
        if 0<=number<len(info):
            print("y or n")
            delmy=input()
            if delmy=='y':
               del info[number]
            print(info)
            break
        else:
            print("该用户不存在")
def modify_info():
    while True:
        number=int(input("请输入要修改的序号："))
        global info
        if 0<=number<len(info):
            print("y or n")
            delmy=input()
            if delmy=='y':
                name=input("请输入姓名：")
                age=int(input("请输入年龄："))
                sex=input("请输入性别：")
                dict1={}
                dict1['name']=name
                dict1['age']=age
                dict1['sex']=sex
                info[number]=dict1
            print(info)
            break
        else:
            print("该用户不存在")
def search_info():
    while True:
        name=input("请输入姓名：")
        age=int(input("请输入年龄："))
        sex=input("请输入性别：")
        global info
        for i in info:
            if i['name']==name and i['age']==age and i['sex']==sex:
                print(i)
                break
        else:
            print("该用户不存在")
def print_all():
    global info
    print(info)
def sum_number(num):
    if num==1:
        return 1
    else:
        return num+sum_number(num-1)
#print(sum_number(99))

"""def number(day):
    if day==6:return 3
    elif day>0:return 0
    else:
        return (number(day+1)+2)*2
print(number(1))
print(number(2))
print(number(3))
"""

"""class washer():
    def __init__(self,name,weight,height):
        self.weight=weight
        self.height=height
        self.name=name
        print("初始化")
    def wash(self):
        print("洗衣服")
    def dry(self):
        print("烘干")
    def clean(self):
        print("打扫")
        def __del__(self):
            print("销毁")
mywash=washer("yoyo",10,2)

mywash.dry()

class digua():
    def __init__(selfself):
        """
"""class potatos():
    def __init__(self):
        self.cook_time=0
        self.cook_static="生的"
        self.condiment=[]

    def cook(self,time):
        

    def eat(self):
        print("吃土豆")"""
class student():
    def __init__(self,name,weight):
        self.name=name
        self.weight=weight
"""    def chi(self):
        self.weight+=1
    def pao(self):
        self.weight-=0.5
    def chakan(self):
        print("姓名：",self.name,"体重：",self.weight)
liaomei=student("廖梅",40)
xiaoming=student("小明",80)
liaomei.chi()
xiaoming.pao()
liaomei.chakan()
xiaoming.chakan()"""


"""class yc():
    def __init__(self):
        self.__name2='yc'
        self.name='yc'
class cy():
    def __init__(self):
        self.name='cy'
class son(yc,cy):
    pass
a=son()
print(a.name2)
"""

"""import math


class Triangle:
    def __init__(self, x, y, z):
        self.__x = x
        self.__y = y
        self.__z = z
        self.__p = x + y + z

    def area(self):
        # 使用海伦公式计算面积
        s = self.__p / 2
        area = math.sqrt(s * (s - self.__x) * (s - self.__y) * (s - self.__z))
        print(f"半周长 P = {self.__p}")
        print(f"面积 = {area}")


a = Triangle(3, 4, 5)
a.area()"""



import socket
"""server= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('localhost',8888))
server.listen(5)
client,addr=server.accept()
print("连接成功:",addr)
data=client.recv(1024)
print('受到数据',data.decode())
msg=input("请输入要发送的数据：")
client.send(msg.encode())
client.close()
server.close()"""

"""clinet=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clinet.connect(('127.0.0.1',8888))
clinet.send(b'hello')"""

"""import socket
import optparse
def port_scan(ip,port):
    try:
        s=socket.socket()
        s.settimeout(5)
        if s.connect_ex((ip,port))==0:
            print(f"[+] Host:{ip},port{port},Status:OPEN")
        else:
            print(f"[+] Host:{ip},port{port},Status:CLOSE")
    except Exception as e:
            print(e)
            pass
    finally:
        s.close()
def main():
    parser=optparse.OptionParser('<Usage>')
    parser.add_option("-i",dest="ip",type='string',help="请输入要扫描的IP地址")
    parser.add_option("-p","--port",dest="port",type='string',help="请输入要扫描的端口号")
    (options,args)=parser.parse_args()
    ip=options.ip
    port=options.port
    if ip is None or port is None:
        print('请输入-h查看命令手册 ')
        return
    try:
        if '-' in port:
            start,end=port.split('-')
            for i in range(int(start),int(end)+1):
                port_scan(ip,i)
        else:
            port_scan(ip,int(port))
    except:
        print('请输入-h查看命令手册 ')

if __name__=='__main__':
    main()
"""

def printCookies(cookiesDB):
    try:
        conn= sqlite3.connect(cookiesDB)
        c=conn.cursor()
        c.execute('SELECT host,name,value FROM moz_cookies')
        print('\n[*] -- Found Cookies --')
        for row in c.fetchall():
            host=str(row[0])
            name=str(row[1])
            value=str(row[2])
            print('[+] Host'+host+',Cookie:'+name+',Value:'+value)
    except Exception as e:
        if 'encrypted' in str(e):
            print('\n[*] Error reading your cookies database.')
            print('[*] Upgrade your Python-Sqlite3 Library')


import sqlite3
def printhistory(placesDB):
    try:
        conn= sqlite3.connect(placesDB)
        c=conn.cursor()
        c.execute \
            ("select ur1, datetime(visit_date/1000000,'unixepoch')"
             "from moz_places,moz_historyvisits where visit_count > 0 and"
             "moz_places.id==moz_historyvisits.place_id;")
        print('\n[*] -- Found History --')
        for row in c.fetchall():
            url=str(row[0])
            date=str(row[1])
            print('[+]'+date+'- Visited:'+url)
    except Exception as e:
        if 'encrypted' in str(e):
            print('\n[*] Error reading your places database.')
            print('[*] Upgrade your Python-Sqlite3 Library')
printhistory("places.sqlite")





